package de.schule.barnimgymnasium.autotransporter;

import java.net.URL;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;

public class Auto extends GameItem {

	int nummer;
	RGB rgb;
	URL sound;

	public Auto(final Composite parent, final int x, final int y,
			final int nummer, final RGB rgb) {
		super(parent, x, y);
		this.nummer = nummer;
		if (rgb == null) {
			throw new IllegalArgumentException("Das Auto hat keine Farbe");
		}
		this.rgb = rgb;
	}

	@Override
	public void setImage(final Image image) {
		final GC gc = new GC(image);
		gc.setForeground(this.parent.getDisplay().getSystemColor(
				SWT.COLOR_BLACK));
		gc.drawText(Integer.valueOf(this.nummer).toString(), 46, 16, true);
		gc.dispose();
		super.setImage(image);
	}

	public void setGeraeusch(URL s) {
		sound = s;
	}

	public RGB getRgb() {
		return this.rgb;
	}

	public URL getGeraeusch() {
		return sound;
	}
}
